<template>
  <div id="app">
    <h2>vuex - {{ name }}</h2>
    <ChildView />
    <ChildView2 />
    <child-view-3 />
    <child-view-4 />
    <child-view-5 />
  </div>
</template>

<script>
import ChildView from "./components/ChildView.vue";
import ChildView2 from "./components/ChildView2.vue";
import ChildView3 from "./components/ChildView3.vue";
import ChildView4 from "./components/ChildView4.vue";
import ChildView5 from "./components/ChildView5.vue";
export default {
  name: "App",
  components: {
    ChildView,
    ChildView2,
    ChildView3,
    ChildView4,
    ChildView5,
  },
  // 通过计算属性来拿vuex的state
  computed: {
    name() {
      return this.$store.state.name;
    },
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
